<?php
session_start ();
$uid = $_SESSION ['uid'];
$username = $_SESSION ['username'];

header ( 'Content-Type:text/html;charset=gbk' );
require_once ("db_manage.php");

$action = $_POST ['action'];
if ($action == "") {
	$action = $_GET ['action'];
}

if ($action == "delete") {
	$id = $_POST ['id'];
	$sql = "delete from pcd_travel where id = " . $id;
	mysql_query ( $sql );
	echo "<script>location.href='travel_all.php';</script>";
} else if ($action == "approve") {
	$id = $_POST ["approveid"];
	$sql = "update pcd_travel set state = 1 where id = " . $id;	
	mysql_query ( $sql );
	echo "<script>location.href='travel_detail.php?id=" . $id . "';</script>";
} else if ($action == "refuse") {
	$id = $_POST ["refuseid"];
	$reason = $_POST ['reason'];
	$sql = "update pcd_travel set state = -1,reason = '" . $reason . "' where id = " . $id;
	mysql_query ( $sql );
	echo "<script>location.href='travel_detail.php?id=" . $id . "';</script>";
}
?>